package com.doge.calcalbum.db.model

import androidx.room.Entity
import androidx.room.PrimaryKey
import com.doge.calcalbum.utils.FileUtils
import java.io.File

@Entity(tableName = "note")
data class Note (
    @PrimaryKey(autoGenerate = true)
    val id: Int = 0,
    val title: String,
    val filePath: String,
    val createTime: Long,
    val selected: Boolean? = null,
) {
    companion object {
        fun noteFileDir(): File {
            return FileUtils.filesDir("notes").also { if (!it.exists()) it.mkdirs() }
        }
    }
}